#include<bits/stdc++.h>

using namespace std;
using ll=long long;
const int maxn = 2e5;
ll h[maxn], b;
int n;

int main() {
    cin >> n >> b;
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    sort(h, h + n, greater<ll>());
    for (int i = 0; i < n; i++) {
        b -= h[i];
        if (b <= 0) {
            cout << i + 1 << endl;
            return 0;
        }

    }
    cout << -1 << endl;
    return 0;
}